package com.jeasonzhao.commons.logger;

public class ConsoleLogListener extends MessageBasedLogListener
{
    private String prefix = null;
    public ConsoleLogListener(String p)
    {
        this.prefix = p;
    }

    public ConsoleLogListener()
    {

    }

    public void log(LogLevel logLevel,String strMessage,Throwable excep)
    {
        String message = formatMessage(logLevel,this.prefix,strMessage,excep);
        if(logLevel == LogLevel.ERROR || logLevel == LogLevel.FATAL)
        {
            System.err.println(message);
        }
        else
        {
            System.out.println(message);
        }
    }
}
